// run: $exec < input
#include <cstdio>
#include <vector>
#include <list>

struct child { int v, d, p, i; };

int const maxn = 4007;
int v[maxn], d[maxn], p[maxn];
int n;

int main()
{
	std::scanf("%d", &n);
	std::list<child> q;
	for (int i = 0; i < n; i++) {
		child tmp;
		std::scanf("%d %d %d", &tmp.v, &tmp.d, &tmp.p);
		tmp.i = i + 1;
		q.push_back(tmp);
	}
	int ans = 0;
	std::vector<int> child_index;
	while (!q.empty()) {
		int tv = q.front().v;
		ans++;
		child_index.push_back(q.front().i);
		q.pop_front();
		auto it = q.begin();
		for (int i = tv; i && it != q.end(); i--, ++it) {
			it->p -= i;
		}
		for (auto it = q.begin(); it != q.end();) {
			if (it->p < 0) {
				int td = it->d;
				it = q.erase(it);
				for (auto it2 = it; it2 != q.end(); ++it2) {
					if (it2->p >= 0) it2->p -= td;
				}
			} else {
				++it;
			}
		}
	}
	std::printf("%d\n", ans);
	for (auto i : child_index) std::printf("%d ", i);
}

